'''※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
File Name: SqlHelper.py
Author: GID5564
Description: 数据库交互
Version: 1.0
Created Time: 04/09/23-10:10:48
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※'''
  
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import pymysql
import pymssql
import sqlite3

class MsSqlHelper(SqlBase):
    def __init__(self, ip: str, db: str, uid: str, pwd: str):
        conn = pymssql.connect(server=ip, user=uid, password=pwd, database=db)
        cursor = conn.cursor()
        SqlBase.__init__(self, cursor, conn)


class MySqlHelper(SqlBase):
    def __init__(self, host: str, user: str, passwd: str, db: str, port=3306, charset='utf8'):
        conn = pymysql.connect(host, user, passwd, port, db, charset)
        cursor = conn.cursor()
        SqlBase.__init__(self, cursor, conn)


class SqliteHelper(SqlBase):
    def __init__(self, db: str):
        conn = sqlite3.connect(db)
        cursor = conn.cursor()
        SqlBase.__init__(self, cursor, conn)